g_free (widget->name);
widget->name = new_name;
- if (GTK_WIDGET_RC_STYLE (widget))
+ if (gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
g_object_notify (G_OBJECT (widget), "name");
* see docs/styles.txt
*****************************************/
+/**
+ * gtk_widget_has_rc_style:
+ * @widget: a #GtkWidget
+ *
+ * Determines if the widget style has been looked up through the rc mechanism.
+ *
+ * Returns: %TRUE if the widget has been looked up through the rc
+ * mechanism, %FALSE otherwise.
+ *
+ * Since: 2.20
+ **/
+gboolean
+gtk_widget_has_rc_style (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return (GTK_WIDGET_FLAGS (widget) & GTK_RC_STYLE) != 0;
+}
+
/**
* gtk_widget_set_style:
* @widget: a #GtkWidget
{
gboolean initial_emission;
- initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
+ initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (!GTK_WIDGET_USER_STYLE (widget) &&
- !GTK_WIDGET_RC_STYLE (widget))
+ !gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
}
GtkStyle *new_style = NULL;
gboolean initial_emission;
- initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
+ initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE);
* modifier style and the only reference was our own.
*/
- if (GTK_WIDGET_RC_STYLE (widget))
+ if (gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
}
static void
reset_rc_styles_recurse (GtkWidget *widget, gpointer data)
{
- if (GTK_WIDGET_RC_STYLE (widget))
+ if (gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
if (GTK_IS_CONTAINER (widget))
#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
#endif
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_RC_STYLE:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the widget's style has been looked up through the rc
* mechanism.
+ *
+ * Deprecated: 2.20: Use gtk_widget_has_rc_style() instead.
*/
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
+#endif
+
#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_COMPOSITE_CHILD:
/* Widget styles.
*/
+gboolean gtk_widget_has_rc_style (GtkWidget *widget);
void gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style);
void gtk_widget_ensure_style (GtkWidget *widget);